package com.zahb.qadx.model;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.google.gson.annotations.SerializedName;

import java.util.List;


public class OfflinePlanBean {


    /**
     * total : 6
     * current : 1
     * hitCount : false
     * pages : 1
     * size : 10
     * optimizeCountSql : true
     * records : [{"planAddress":"华腾国际","teacherName":null,"planName":"第六节课","userId":null,"planDate":"2021-01-20","completeNum":null,"classId":135,"teacherId":null,"hasNotes":0,"learnHours":1,"planId":21,"startTime":"2021-01-20 13:00:00","assignNum":null,"isNote":false,"endTime":"2021-01-20 17:01:11"},{"planAddress":"华腾国际","teacherName":null,"planName":"第五节课","userId":null,"planDate":"2021-01-20","completeNum":null,"classId":135,"teacherId":null,"hasNotes":0,"learnHours":1,"planId":20,"startTime":"2021-01-20 09:00:24","assignNum":null,"isNote":false,"endTime":"2021-01-20 11:00:00"},{"planAddress":"华腾国际","teacherName":null,"planName":"第四节课","userId":null,"planDate":"2021-01-19","completeNum":null,"classId":135,"teacherId":null,"hasNotes":0,"learnHours":1,"planId":19,"startTime":"2021-01-19 13:00:01","assignNum":null,"isNote":false,"endTime":"2021-01-19 17:00:15"},{"planAddress":"大咨询中故土万事大吉上原封不动8楼古城扔有利于","teacherName":null,"planName":"19号第三节课","userId":null,"planDate":"2021-01-19","completeNum":null,"classId":135,"teacherId":95,"hasNotes":0,"learnHours":3,"planId":18,"startTime":"2021-01-19 09:30:00","assignNum":null,"isNote":false,"endTime":"2021-01-19 11:30:00"},{"planAddress":"华腾国际","teacherName":null,"planName":"第二节课","userId":null,"planDate":"2021-01-18","completeNum":null,"classId":135,"teacherId":100,"hasNotes":0,"learnHours":1,"planId":17,"startTime":"2021-01-18 11:35:00","assignNum":null,"isNote":false,"endTime":"2021-01-18 13:00:00"},{"planAddress":"华腾国际","teacherName":null,"planName":"第一节课","userId":null,"planDate":"2021-01-18","completeNum":null,"classId":135,"teacherId":100,"hasNotes":0,"learnHours":1,"planId":16,"startTime":"2021-01-18 09:00:00","assignNum":null,"isNote":false,"endTime":"2021-01-18 11:30:00"}]
     * searchCount : true
     * orders : []
     */
    private int total;
    private int current;
    private boolean hitCount;
    private int pages;
    private int size;
    private boolean optimizeCountSql;
    private List<RecordsEntity> records;
    private boolean searchCount;
    private List<?> orders;

    public void setTotal(int total) {
        this.total = total;
    }

    public void setCurrent(int current) {
        this.current = current;
    }

    public void setHitCount(boolean hitCount) {
        this.hitCount = hitCount;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public void setOptimizeCountSql(boolean optimizeCountSql) {
        this.optimizeCountSql = optimizeCountSql;
    }

    public void setRecords(List<RecordsEntity> records) {
        this.records = records;
    }

    public void setSearchCount(boolean searchCount) {
        this.searchCount = searchCount;
    }

    public void setOrders(List<?> orders) {
        this.orders = orders;
    }

    public int getTotal() {
        return total;
    }

    public int getCurrent() {
        return current;
    }

    public boolean isHitCount() {
        return hitCount;
    }

    public int getPages() {
        return pages;
    }

    public int getSize() {
        return size;
    }

    public boolean isOptimizeCountSql() {
        return optimizeCountSql;
    }

    public List<RecordsEntity> getRecords() {
        return records;
    }

    public boolean isSearchCount() {
        return searchCount;
    }

    public List<?> getOrders() {
        return orders;
    }

    public static class RecordsEntity implements Parcelable {
        /**
         * planAddress : 华腾国际
         * teacherName : null
         * planName : 第六节课
         * userId : null
         * planDate : 2021-01-20
         * completeNum : null
         * classId : 135
         * teacherId : null
         * hasNotes : 0
         * learnHours : 1.0
         * planId : 21
         * startTime : 2021-01-20 13:00:00
         * assignNum : null
         * isNote : false
         * endTime : 2021-01-20 17:01:11
         */
        private String planAddress;
        private String teacherName;
        private String planName;
        private String userId;
        private String planDate;
        private String completeNum;
        private int classId;
        private int teacherId;
        private int hasNotes;

        private double learnHours;
        private int planId;
        private String startTime;
        private String assignNum;
        private boolean isNote;
        private String endTime;

        public void setPlanAddress(String planAddress) {
            this.planAddress = planAddress;
        }

        public void setTeacherName(String teacherName) {
            this.teacherName = teacherName;
        }

        public void setPlanName(String planName) {
            this.planName = planName;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public void setPlanDate(String planDate) {
            this.planDate = planDate;
        }

        public void setCompleteNum(String completeNum) {
            this.completeNum = completeNum;
        }

        public void setClassId(int classId) {
            this.classId = classId;
        }

        public void setTeacherId(int teacherId) {
            this.teacherId = teacherId;
        }

        public void setHasNotes(int hasNotes) {
            this.hasNotes = hasNotes;
        }

        public void setLearnHours(double learnHours) {
            this.learnHours = learnHours;
        }

        public void setPlanId(int planId) {
            this.planId = planId;
        }

        public void setStartTime(String startTime) {

            this.startTime = startTime;
        }

        public void setAssignNum(String assignNum) {
            this.assignNum = assignNum;
        }

        public void setIsNote(boolean isNote) {
            this.isNote = isNote;
        }

        public void setEndTime(String endTime) {
            this.endTime = endTime;
        }

        public String getPlanAddress() {
            return planAddress;
        }

        public String getTeacherName() {
            return teacherName;
        }

        public String getPlanName() {
            return planName;
        }

        public String getUserId() {
            return userId;
        }

        public String getPlanDate() {
            return planDate;
        }

        public String getCompleteNum() {
            return completeNum;
        }

        public int getClassId() {
            return classId;
        }

        public int getTeacherId() {
            return teacherId;
        }

        public int getHasNotes() {
            return hasNotes;
        }

        public double getLearnHours() {
            return learnHours;
        }


        public String getLearnHoursStr(){
            String s = learnHours+"";
            if(s.endsWith(".0")){
                s = s+"0";
            }
            return s;
        }

        public int getPlanId() {
            return planId;
        }

        public String getStartTime() {
            if(startTime.length()>16){
                return startTime.substring(0,16);
            }
            return startTime;
        }

        public String getAssignNum() {
            return assignNum;
        }

        public boolean isIsNote() {
            return isNote;
        }

        public String getEndTime() {
            if(!TextUtils.isEmpty(endTime) && endTime.length()>16){
                return endTime.substring(11,16);
            }
            return endTime;
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.planAddress);
            dest.writeString(this.teacherName);
            dest.writeString(this.planName);
            dest.writeString(this.userId);
            dest.writeString(this.planDate);
            dest.writeString(this.completeNum);
            dest.writeInt(this.classId);
            dest.writeInt(this.teacherId);
            dest.writeInt(this.hasNotes);
            dest.writeDouble(this.learnHours);
            dest.writeInt(this.planId);
            dest.writeString(this.startTime);
            dest.writeString(this.assignNum);
            dest.writeByte(this.isNote ? (byte) 1 : (byte) 0);
            dest.writeString(this.endTime);
        }

        public RecordsEntity() {
        }

        protected RecordsEntity(Parcel in) {
            this.planAddress = in.readString();
            this.teacherName = in.readString();
            this.planName = in.readString();
            this.userId = in.readString();
            this.planDate = in.readString();
            this.completeNum = in.readString();
            this.classId = in.readInt();
            this.teacherId = in.readInt();
            this.hasNotes = in.readInt();
            this.learnHours = in.readDouble();
            this.planId = in.readInt();
            this.startTime = in.readString();
            this.assignNum = in.readString();
            this.isNote = in.readByte() != 0;
            this.endTime = in.readString();
        }

        public static final Creator<RecordsEntity> CREATOR = new Creator<RecordsEntity>() {
            @Override
            public RecordsEntity createFromParcel(Parcel source) {
                return new RecordsEntity(source);
            }

            @Override
            public RecordsEntity[] newArray(int size) {
                return new RecordsEntity[size];
            }
        };
    }
}
